//
//  CourceHomeCell.m
//  YUXiu
//
//  Created by 王竞成 on 16/6/24.
//  Copyright © 2016年 Wang. All rights reserved.
//
// headImg;
// courseTitle;
// courseSubTitle;
// author;
// authName;
// priceLabel;
// memberShare;

#import "CourceHomeCell.h"

@implementation CourceHomeCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier Model:(courseModel *)model{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        self.backgroundColor = kGrayCOLOR;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initView:model];
    }
    return self;
}
//height 100;
- (void)initView:(courseModel *)model{
    _headImg = [[UIImageView alloc]initWithFrame:krect(10, 10, 120, 80)];
    _headImg.layer.cornerRadius = 5;
    _headImg.layer.masksToBounds = YES;
    
    [_headImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",model.imgName]] placeholderImage:[UIImage imageNamed:@"nopoto160x200"]];
    
    [self addSubview:_headImg];
    
    _courseTitle = [[UILabel alloc]initWithFrame:krect(_headImg.golf_right + 10, _headImg.golf_top +3, kScreenWidth - 120, 30)];
    _courseTitle.text = @"课程合集名称";
    _courseTitle.font = Font(16);
    _courseTitle.textColor = kBlackCOLOR;
    
    [self addSubview:_courseTitle];
    
    _courseSubTitle = [[UILabel alloc]initWithFrame:krect(_courseTitle.golf_left, _courseTitle.golf_bottom + 7, _courseTitle.golf_width, 10)];
    _courseSubTitle.text = @"高级体式的瑜珈有...";
    _courseSubTitle.font = Font(14);
    _courseSubTitle.textColor = kGrayCOLOR;
    [self addSubview:_courseSubTitle];
    
    _author = [[UILabel alloc]initWithFrame:krect(_headImg.golf_right+10, _headImg.golf_bottom-22, 30, 20)];
    _author.text = @"作者:";
    _author.font = Font(14);
    _author.textColor = kGrayCOLOR;
    _author.numberOfLines = 1;
    _author.lineBreakMode = NSLineBreakByCharWrapping;
    [_author sizeToFit];
    [self addSubview:_author];
    //
    _authName = [[UILabel alloc]initWithFrame:krect(_author.golf_right, _headImg.golf_bottom-22, 140, 20)];
    _authName.text = @"songqingshu";
    _authName.font = Font(14);
    _authName.textColor = kOrangeCOLOR;
    _authName.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_authName];
   
    _memberShare = [[UILabel alloc]initWithFrame:krect(kScreenWidth-85, _headImg.golf_top +3, 70, 20)];
    _memberShare.layer.cornerRadius = 5;
    _memberShare.text = @"会员专享";
    _memberShare.layer.masksToBounds = YES;
    _memberShare.textAlignment = NSTextAlignmentCenter;
    _memberShare.textColor = kWhiteCOLOR;
    _memberShare.backgroundColor = kRedCOLOR;
    [self addSubview:_memberShare];
    
    _priceLabel = [[UILabel alloc]initWithFrame:krect(kScreenWidth-60, _headImg.golf_top +3, 50, 20)];
    _priceLabel.textColor = kOrangeCOLOR;
    _priceLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:_priceLabel];
    
    UIView *line = [[UIView alloc]initWithFrame:krect(5, 99, kScreenWidth-10, 1)];
    [line setBackgroundColor:kLightGrayCOLOR];
    [self addSubview:line];
}


@end
